<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        function getParams(data){
            var str='';
            for(var key in data){
                str+=key+"="+data[key]+"&";
            }
            return str;
        }

        function jsonp(url,data,callback,jsonpCallback="cb"){
            var fnName="itzan"+parseInt(Math.random()*1000);
            window[fnName]=callback;
            var newUrl=url+"?"+getParams(data)+jsonpCallback+"="+fnName;
            var oScript=document.createElement("script");

            oScript.setAttribute("src",newUrl);
            document.body.appendChild(oScript);
            oScript.onload=function(){
                this.remove();
            }
        }


        jsonp("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su",{wd:"徐涛"},function(res){
            console.log(res);
        })

    </script>
    <!-- <script>
        function getParams(data){
            var str="";
            for(var key in data){
                str+=key+"="+data[key]+"&";
            }
            return str;
        }
        function jsonp(url,data,callback,jsonpCallback="cb"){
        var fnName="itzan"+parseInt(Math.random()*1000);
        window[fnName]=callback;
        var newUrl=url+"?"+getParams(data)+jsonpCallback+"="+fnName;
        var oScript=document.createElement("script");
        oScript.setAttribute("src",newUrl);
        document.body.appendChild(oScript);
        oScript.onload=function(){
            this.remove();
          }
        }
        jsonp("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su",{wd:"罗赞"},function(res){
            console.log(res);
        })
    </script> -->

</body>
</html>